Add optional Copilot budget extras#1273
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 9, 2026, 5:25 AM ET / 09:25 UTC. Summary Reproducibility: not applicable. this is a new opt-in feature, not a broken current-main behavior. The PR body screenshots show the after-change menu/settings state, and source/tests cover the fetch path. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge only if a maintainer explicitly approves the opt-in GitHub web-cookie billing boundary; keep the feature disabled by default and treat organization budgets as separate follow-up work. Do we have a high-confidence way to reproduce the issue? Not applicable; this is a new opt-in feature, not a broken current-main behavior. The PR body screenshots show the after-change menu/settings state, and source/tests cover the fetch path. Is this the best way to solve the issue? Unclear until maintainer approval; the implementation is opt-in and best-effort with account-binding coverage, but whether CodexBar should use GitHub web billing cookies is a product/security decision. AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against a4f278d91fe4. Label changesLabel justifications:
Evidence reviewedSecurity concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
Findings
Proof Added
Validation
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
a9c9694 to
3b902c6
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
3b902c6 to
e6aeb62
Compare
|
Rebased with no changes to fix a bogus workflow error, to get the green checkmark. |
e6aeb62 to
445bcf3
Compare
@steipete need your explicit approval for this |
- Import optional GitHub web budget windows for Copilot - Add settings for budget extras, cookies, and icon selection - Cover the new resolver, fetcher, and settings persistence
- Default Copilot budget cookie import to Chrome only - Surface budget fetch and decode failures consistently - Cover cookie defaults and invalid budget JSON
- Ignore stale manual cookies when budget cookies are auto - Cover Copilot budget cookie source routing
- Default budget extras off unless explicitly enabled - Harden budget web fetch and manual cookie refresh - Document budget cookie and reset heuristics
- Forward the budget extras setting into provider previews - Cover Copilot preview budget visibility
- Centralize UsageSnapshot extra-window copying - Clear Copilot reset baselines consistently - Remove dead Copilot budget overloads - Log when budget pagination hits the page cap
- Thread selected Copilot account identity into settings - Reject budget cookie sessions for a different GitHub account - Cover the matching and mismatched account flows in tests
- Resolve GitHub identity from the active token before cookie checks - Cover stale selected account identifiers in budget tests
- Treat missing budget identity metadata as invalid response - Reuse compiled meta parsing regexes and tighten test stubs
- Clear mismatched cached budget cookies before browser fallback - Treat missing GitHub identity as an unknown account mismatch - Cover cached mismatch and missing-identity fallback behavior
445bcf3 to
06eb61b
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Summary
This PR adds an opt-in Copilot budget extras feature. When enabled, CodexBar keeps the existing Copilot usage fetch via the GitHub Copilot internal API, then best-effort fetches the user's configured GitHub billing budgets from the logged-in GitHub web billing endpoint and renders matching Copilot budgets as extra menu bars.
The feature is disabled by default. If the budget fetch fails, is unauthenticated, or returns no positive Copilot-related budgets, the normal Copilot usage bars remain unchanged.
Note: I cannot test organization-based budgets, therefore I have not implemented them. These would be more easily fetched via the documented API endpoints, without requiring web-based cookie auth. Leaving this note here in case anyone cares to implement it in a follow-up.
Motivation
Budgets play an increasing crucial role now, with the coming (now present) changes to Github Copilot billing, becoming token-usage based, as it'll become much easier to hit the plan's included usage and trigger configured budgets.
What Changed
CopilotBudgetWebFetcher, which fetcheshttps://github.com/settings/billing/budgets?page=<page>&page_size=10&scope=customerusing github.com web cookies and maps positive Copilot-related budgets intoextraRateWindows.payload.budgets,uuid,pricingTargetId,pricingTargetType,targetName,targetAmount, andcurrentAmount.Budget - <budget type>, for exampleBudget - All Premium Request SKUs.Budget extras, disabled by default.Menu bar secondary metric, allowing the icon's second meter to use Chat or a specific budget bar.docs/copilot.md.Safety And Fallbacks
invalidResponseerror.Tests
Validated during the review/assessment pass:
swift test --filter CopilotBudgetWebFetcherTestsswift test --filter CopilotBudgetCookieRoutingTestsswift test --filter BrowserCookieOrderStatusStringTestsswift test --filter ProviderSettingsDescriptorTestsswift test --filter ProvidersPaneCoverageTestsswift test --filter MenuCardModelTestsmake checkswift testFinal full-suite rerun passed with 3,235 tests in 386 suites.
Review Notes
Main agent was GPT-5.5 on high reasoning with user oversight.
Code was assessed with CodeRabbit, Codex review, and LGTM (Copilot Code Review + Gemini 3.1 Pro Preview + Claude Sonnet 4.6 + Claude Opus 4.8 + Raptor mini). Review fixes landed for cookie import defaults, cookie routing, fetch error handling, malformed amount parsing, manual-cookie refresh UX, budget extras default state, docs, settings preview behavior, centralized
UsageSnapshotextra-window copying, reset-baseline cleanup, pagination cap logging, and dead overload removal. The final Codex review reported no remaining findings.Proof